

<div class="padding4020">
    <h2 class="profil_h2"><?php echo $cat['name']; ?></h2>
    
    <?php if(!empty($cat['about'])) : ?>
        <div class="pull-left" style="width:500px;margin-bottom: 20px;">
            <?php $data = split('<more>', $cat['about']); ?>
            <?php echo $data[0]; ?>
            <?php if(!empty($data[1])) : ?>
                <span class="aboutMore"> <?php echo $data[1]; ?> </span>
                <a href="javascrip:void(0);"id="showAboutMore" onclick="return false;">Читать дальше &rarr;</a>
            <?php endif; ?>
        </div>        
    <?php endif; ?>
    <span class="cat_banner pull-right ">
        <?php if(!empty($this->advertCode)) : ?>
            <?php echo $this->advertCode; ?>
        <?php else : ?>
            <img src="/images/banners/cat_banner.png" alt="">
        <?php endif; ?>
    </span><div class="clearfix"></div>
    
   <!-- Если в этой категории есть подкатегории нужно их тут выводить и знаю какая из них сейчас  -->
   <?php if(!empty($catSubCats)) : ?>
       <div class="pull-left">
            <ul class="unstyled subcat_menu ">
                <?php foreach ($catSubCats as $item) : ?>
                    <li <?php echo $item['catId'] == $cat['catId'] ? 'class="btn"' : '' ?> > 
                        <a href="<?php echo Yii::app()->createUrl('partner/default/cat', array('catId'=>$item['catId'], 'parentId'=>$item['parentId'])); ?>"><?php echo $item['name']; ?></a>
                    </li>
                <?php endforeach; ?>
            </ul>         
       </div> 
   <?php endif; ?>
<div class="clearfix"></div>      
</div>

<?php $params = isset($_GET['parentId']) ? array('parentId'=>$_GET['parentId'], 'catId'=>$cat['catId']) : array('catId'=>$cat['catId']); ?>    

<ul id="tabs">
<li class="first activ_tab">
     <a class="" href="<?php echo Yii::app()->createUrl('partner/default/cat', $params); ?>">Рейтинг</a>
    </li>
<li class=""> 
            <a class="" href="<?php echo Yii::app()->createUrl('partner/news/allCatNews', array('catId'=>$cat['catId'])); ?>">Новости и аналитика</a>
    </li> 
<li class="">  
            <a class="last" href="<?php echo Yii::app()->createUrl('partner/default/topForums', array('catId'=>$cat['catId'])); ?>">Топ Мини-форумов</a>
    </li>
</ul>

<div class="tabs_wraper"></div>

<div class="padding040">
     <div  class="partnersList">

         
           <?php 
                    $this->widget('application.widgets.CatsRatingGrid',  
                        array('dataProvider' => $dataProvider,
                            'summaryText' => '',
                         //   'sort'=>array('name','mean','field1','field2','field3','field4','openDate','editorMark'),
                            'rowCssClassExpression'=>'$this->dataProvider->data[$row]["close"] ? "tr_class_close" : ""',
                            #function($row, $data) {if ($data['close']) return 'tr_class_close';},
                            'cssFile' => false,
                            'zeroPartners'=>!empty($cat['zeroPart']) ? $cat['zeroPart'] : array(),
                            'itemsCssClass' => 'cat_rating_table',
                            'pager'=>array(
                                'class'=>'CLinkPager',
                                'header'=>'',
                            ),
                            'columns' => array (
                                array('name'=>'partnerName', 'htmlOptions'=>array('class'=>'part_name'), 'header'=>'', 'type'=>'raw', 'value'=>' "<a class=\"table_cat_partner_name\" href=\"".$data["url"]."\">".$data["partnerName"]."</a>".$data["relCats"]'),
                                array('name'=>'mean', 'htmlOptions'=>array('class'=>'center_row'),'header'=>'Рейтинг',  'type'=>'raw', 'value'=>'$data["close"] ? "<i style=\"float:right; \"  class=\"icon-lock\"></i>" : $data["mean"]>0 ? $data["mean"] >= $data["oldMean"] ? "<span class=\"rating_up_icon\">&nbsp;</span><span class=\"rating_up\">".round($data["mean"] - $data["oldMean"],1)."</span><span class=\"rating_value\">".round($data["mean"],1)."</span> <span class=\"count_rating\">".$data["votes"]."</span>" : "&#9660;<span style=\"color:red;font-size:10px;margin-right:10px\">".round($data["oldMean"] - $data["mean"],2)."</span><span class=\"rating_value\">".$data["mean"]."</span> <b>".$data["votes"]."</b>" : "<span title=\"Не достаточно данных для расчета\">n/a"'),
                                array('name'=>'field1', 'htmlOptions'=>array('class'=>'center_row'), 'header'=>$cat['reviewRating1'],'type'=>'raw', 'value'=>'$data["field1"] > 0 ? round($data["field1"],2) : "<span title=\"Не достаточно данных для расчета\">n/a" '),
                                array('name'=>'field2', 'htmlOptions'=>array('class'=>'center_row'),'header'=>$cat['reviewRating2'], 'type'=>'raw', 'value'=>'$data["field2"] > 0 ? round($data["field2"],2) : "<span title=\"Не достаточно данных для расчета\">n/a"'),
                                array('name'=>'field3', 'htmlOptions'=>array('class'=>'center_row'),'header'=>$cat['reviewRating3'], 'type'=>'raw', 'value'=>'$data["field3"] > 0 ? round($data["field3"],2) : "<span title=\"Не достаточно данных для расчета\">n/a"'),
                                array('name'=>'field4', 'htmlOptions'=>array('class'=>'center_row'),'header'=>$cat['reviewRating4'], 'type'=>'raw', 'value'=>'$data["field4"] > 0 ? round($data["field4"],2) : "<span title=\"Не достаточно данных для расчета\">n/a"'),
                                array('name'=>'dateOpen','htmlOptions'=>array('class'=>'center_row'), 'header'=>'<i class="icon icon-off"></i>', 'type'=>'raw',  'value'=>'"<span style=\"font-size:11px;\">".$data["dateOpen"]."</span>"'),
                                array('name'=>'editorMark','htmlOptions'=>array('class'=>'center_row'), 'header'=>'<i class="icon icon-heart"></i>', 'type'=>'raw', 'value'=>'"<span class=\"icon_hearth".$data["editorMark"]."\"></span>"'),
                                array('name'=>'help', 'htmlOptions'=>array('class'=>'right_row'),  'header'=>'<a href="javascript:void(0);"  rel="popover" data-content="'.$cat['ratingRules'].'" data-original-title="Подсказка"><i class="icon icon-question-sign"></i></a>', 'type'=>'raw', 'value'=>''),
                                array('name'=>'close', 'visible'=>false, 'header'=>'', 'value'=>'$data["close"]'),
                            ),
                            'emptyText' => 'В данной категории нет партнерских программ. Пожалуйста попробуйте зайти через некоторое время.',
                    ));
                    ?>
         
         
         
         
   </div>
    
    <?php if(!empty($relPartners)) : ?>
        <h2 class="profil_h2">Косвенные партнерки</h2>
         <div class="kos_partners">
        <?php foreach($relPartners as $item) : ?>
         <div class="rel_part_block">  
          <div class="pull-left">   
           <a class="kos_link" href="<?php echo Yii::app()->createUrl('partner/profile/index', array('catId'=>$item['catId'], 'partnerUrl'=>$item['url'])) ?>"><?php echo $item['name'] ?></a><br/>
           <a class="partner_home_cat_name none" href="<?php echo Yii::app()->createUrl('partner/default/cat', array('catId'=>$item['catId'])); ?>" ><?php echo $item['catName']; ?></a>
          </div>
             
           <div class="pull-left" style="width: 100px;text-align: center;margin: 0px 20px 0px 10px;line-height: 40px;">  
               <?php if($item['mean'] > 0) {  ?>
               
                    <span style="font-size:21px;"><?php echo  round($item['mean'], 2); ?></span>
                        <?php } else {  ?>
                       <span title="не достаточно данных для расчета">n/a</span>  <?php  } ?>
                    <?php if($item['mean'] > 0) : ?>
                        <span class="kos_count_rating"><?php echo $item['votes']; ?></span>
                    <?php endif; ?>
           </div>      
             
           <div class="pull-left" style="width:590px;">   
                    <?php echo !empty($item['about']) ? CPartnerkiHelper::getShortText($item['about'], 120) : ''; ?>
           </div> 
            
          </div>
             <div class="clearfix"></div>
        <?php endforeach; ?>
         </div>         
    <?php endif; ?>
</div>
<div class="padding20 last_footer_block"> 
    <?php if(!empty($lastThemes)) : ?>
        <div class="span5">
            <h4 class="last_forum_title">Последние <a href="">темы</a> на форуме</h4>
              <div class="last_themes">  
               <?php foreach ($lastThemes as $item) : ?>
                    <?php $params = array('catId'=>$item['catId'], 'partnerUrl'=>$item['partnerUrl'], 'url'=>$item['url']); ?>
                    <a href="<?php echo Yii::app()->createUrl('partner/forum/theme', $params);?>" >
                      <?php echo CPartnerkiHelper::getShortText($item['title'], 40) ?>
                    </a><br/>    
               <?php endforeach; ?>
            </div></div>
    <?php endif; ?>

    <?php if(!empty($lastPosts)) : ?>    
        <div class="span6">
            <h4  class="last_forum_title">Последние <a href="">сообщения</a> на форуме</h4>    
            <div class="bubble">
                <?php foreach ($lastPosts as $item) : ?>
                <?php $params = $item['parentId'] ? array('parentId'=>$item['parentId'], 'catd'=>$item['catId'], 'partnerUrl'=>$item['url'], 'id'=>$item['themeId']) : array('catId'=>$item['catId'], 'partnerUrl'=>$item['url'], 'id'=>$item['themeId']); ?>
                <div class="user_forum_name pull-left">
                    <a href="<?php echo Yii::app()->createUrl('user/profile/profile', array('login'=>$item['login'])); ?>">
                        <?php echo !empty($item['displayName']) ? $item['displayName'] : $item['login']; ?>
                    </a>
                </div>
                <div class="user_post_forum pull-left"> <?php echo CPartnerkiHelper::getShortText($item['text'], 50); ?></div>
                <div class="user_post_forum_count pull-left"><a href="<?php echo Yii::app()->createUrl('partner/forum/theme', $params); ?>"><?php echo $item['countComments']; ?></a></div>
                <?php endforeach; ?>
                <div class="clearfix"></div>
            </div> 
            <div class="bub"></div>
        </div>
    <?php endif; ?>
</div>

